Examples of simple and complex expressions

Expressions can be simple or complex.

A simple expression is the same as a single operand. When you create a search limit, you can select a simple expression like LIBRARY = “MAIN” from the Expression drop-down list to limit search results to items owned by the Main Library.
A complex expression is two or more operands joined by the AND operator, or the OR operator. When you create a search limit, you can select a complex expression like LIBRARY = “MAIN” OR LIBRARY = “NORTH” in the Expression drop-down list to limit search results to items owned by either the Main Library, or by the North Branch Library.

Using a simple expression to limit by genre

In this example of a simple expression, an administrator wants to automatically limit search results to romance novels. In the Operand Builder fields, the administrator selects the search field, operator, and the desired value as follows.

Field: GENRE_TERM
Operator: =
Value: Romance

The administrator then moves to the Search Limit fields, and does the following:

Gives the search limit an entry code of ROMANCE_NOV.
Specifies the localized name as Romance Novels, and selects English (United States) as the language for the localized name.
Specifies the Evaluation Type to be used as Default False.
Selects the operand in the Expression field.

The Search Limit fields and information look like the following when the administrator finishes creating the search limit.

Entry Code: ROMANCE_NOV
Name: Romance Novels English (United States)
Evaluation Type: Default False
Expression: GENRE_TERM = ROMANCE

When the search limit is used, a record will be a match (a search result) if the Genre search field contains a value of ROMANCE. For any records from sources that do not have that search field, the expression will default to FALSE and the result will not be included in the search.

Using a complex expression to limit by reading level

This example of a complex expression is a continuation of the final example in Examples of operands. An administrator wants to make available to patrons a search limit that will limit search results to materials with reading levels from level 4 through level 6. The administrator has already created the following operands using the Operand Builder fields.

READING_LEVEL >=”4”
READING_LEVEL <=”6”

The administrator moves to the Expression Builder fields and makes the following selections.

Operand: READING_LEVEL >=”4”
Operator: AND
Operand: READING_LEVEL <=”6”

The administrator then moves to the Search Limit fields to create the search limit. The administrator does the following.

Gives the search limit an entry code of UPPER_ELEM_LEVELS.
Specifies the localized name as Show only items for Reading Level 4 through Level 6, and selects English (United States) as the language for the localized name.
Specifies the Evaluation Type to be used as Exclusive.
Selects the complex expression in the Expression field.

The Search Limit fields and information look like the following when the administrator finishes creating the search limit.

Entry Code: UPPER_ELEM_LEVELS
Name: Show only items for Reading Level 4 through Level 6 English (United States)
Evaluation Type: Exclusive
Expression: READING_LEVEL >=”4” AND READING_LEVEL <=”6”

When the search limit is used, a record will be a match if the value for the Reading Level field is 4, 5, or 6. Any records from sources that do not contain the Reading Level field will be excluded from the search.

Using a complex expression to include on-order items in a search by library

In this example of a complex expression, an administrator wants to allow patrons to include certain items that are on-order and have not yet been assigned a library location in a search for items that belong to that particular library (Main). Using the Operand Builder fields, the administrator builds two operands using the following values for the fields:

Field: LIBRARY
Operator: =
Value: MAIN

Field: LIBRARY
Operator:is empty
Value: N/A

The administrator moves to the Expression Builder fields and makes the following selections.

Operand: LIBRARY ="MAIN"
Operator: OR
Operand: LIBRARY is empty

The administrator then moves to the Search Limit fields to create the search limit. The administrator does the following.

Gives the search limit an entry code of MAIN_AND_ON_ORDER.
Specifies the localized name as Items belonging to Main Library (including on-order), and selects English (United States) as the language for the localized name.
Specifies the Evaluation Type to be used as Inclusive.
Selects the complex expression in the Expression field.

The Search Limit fields and information look like the following when the administrator finishes creating the search limit.

Entry Code: MAIN_AND_ON_ORDER
Name: Items belonging to Main Library (including on-order) English (United States)
Evaluation Type: Inclusive
Expression: LIBRARY=”MAIN” OR LIBRARY is empty

When the search limit is used, a record will be a match if the value for the Library field is MAIN or if there is no value. Any records from sources that do not contain the Location field will be included in the search, so the results will include any eRC titles that the library has access to.

Related topics 

 


© 2008, 2016 SirsiDynix